package com.itheima.Demo7bufferedinputstream;


import java.io.*;

public class BufferedInputStream1
{
    //自带8k缓存
    public static void main(String[] args) {
        //把低级的字节输入流转换为高级的缓冲字节输入流
        demo1("src\\com\\itheima\\Demo7bufferedinputstream\\123","src\\com\\itheima\\Demo7bufferedinputstream\\456");

    }
    public static void demo1(String srcPath,String destPath)
    {
        try (BufferedInputStream bis=new BufferedInputStream(new FileInputStream(srcPath));
            BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream(destPath)))
        {
            //读取一个字节数组
            byte[] bytes = new byte[1024];
            int len;
            while((len=bis.read(bytes))!=-1){
                bos.write(bytes,0,len);
            }
        }catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}
